package com.wf.log.dao;

import java.sql.Timestamp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class LogDaoImpl implements LogDao{

	@Autowired
	JdbcTemplate jdbcTemplate;

	public boolean addArticleInfo(String ip,String ipregion,int indexType) {
		String sql="INSERT INTO Uservisitlog (ip,ipregion,visitTime,indexType) VALUES (?,?,?,?)";
		jdbcTemplate.update(sql,ip,ipregion,new Timestamp(System.currentTimeMillis()),indexType);
		return true;
	}

	public long getArticleInfoCount() {
		String sql="SELECT COUNT(1) FROM Uservisitlog";
		return jdbcTemplate.queryForObject(sql, Long.class);
	}

}
